/*
 * AfmPolicy.cpp
 *
 *  Created on: 07 Ιουν 2010
 *      Author: Sartios
 */

#include "AfmPolicy.h"
#include "../../../WordValidators/StringIsNumericValidator/StringNumericValidator.h"

AfmPolicy::AfmPolicy() {
	MINIMUM_LENGTH = new int(10);
}

AfmPolicy::~AfmPolicy() {
	delete MINIMUM_LENGTH;
}

bool	AfmPolicy::insuranceNumberAgreeWithBusinessPolicy(const string *insuranceNumber){
	bool agreeToBusinessPolicy = false;
	if(insuranceNumberHasAppropriateLength(insuranceNumber)){
		if(insuranceNumberHasAppropriateContent(insuranceNumber)){
			agreeToBusinessPolicy = true;
			return agreeToBusinessPolicy;
		}
	}
	return agreeToBusinessPolicy;
}

bool	AfmPolicy::insuranceNumberHasAppropriateLength(const string *insuranceNumber){
	bool	lengthIsAppropriate = false;
	if(NULL!=insuranceNumber){
		lengthIsAppropriate = (*MINIMUM_LENGTH<=insuranceNumber->size())?true:false;
	}
	return lengthIsAppropriate;
}

bool	AfmPolicy::insuranceNumberHasAppropriateContent(const string *insuranceNumber){
	bool	contentIsAppropriate = false;
	if(NULL!=insuranceNumber){
		IStringNumericValidator *stringValidator = new StringNumericValidator;
		contentIsAppropriate = stringValidator->stingIsNumeric(insuranceNumber);
	}
	return contentIsAppropriate;
}
